﻿using System;
using System.Windows.Input;
using ReactiveUI;

namespace Avalonia.Exusiai.Editor.ViewModels;

public class InputDialogViewModel:ViewModelBase
{
    public InputDialogViewModel(string text)
    {
        InputText = text;
        OKCommand = ReactiveCommand.Create(Ok);
        CancelCommand = ReactiveCommand.Create(Cancel);
    }
    public string InputText { get; set; }
    public ICommand OKCommand { get; set; }
    public ICommand CancelCommand { get; set; }
    private bool _isOK;
    public bool IsOK
    {
        get => _isOK;
        set => this.RaiseAndSetIfChanged(ref _isOK, value);
    }

    private void Ok()
    {
        IsOK = true;
        if (accept!=null)
        {
            accept(this, EventArgs.Empty);
        }
    }

    private void Cancel()
    {
        return;
    }

    public event EventHandler accept;

}